<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function mostToalChar(str){
            var o={};
            for(var i=0;i<str.length;i++){
                 var char= str.charAt(i);
                 if(o[char]){
                     o[char]++;
                 }else{
                     o[char]=1;
                 }
            }
            console.log(o);

            var max=0;
            var maxCar='';
            for(var key in o){
                if(max<o[key]){
                    max=o[key]
                    maxCar=key
                }
            }
            console.log('最多的字符：'+maxCar);
            console.log('最多少的字符数：'+max);
           
        }

        mostToalChar("cjdsdknisgoigjvkfdshgeshghfidhc")
    </script>
</body>
</html>